Sorry to resurrect this interesting topic so much later. I came to it after looking for a script that allows us to select in a menu at the start if we want to start emulationstation or the desktop. I know that it's not exactly the same as what was discussed in this thread but it's very related. I've ended up making a custom script modifying /opt/retropie/configs/all/autostart.sh, and since I think it might be useful to someone, I'll leave it here for reference (this is the new content of that autostart.sh file):
## Get WT Sizes
WT_HEIGHT=18
WT_WIDTH=$(tput cols)
if [ -z "$WT_WIDTH" ] || [ "$WT_WIDTH" -lt 60 ]; then
WT_WIDTH=80
fi
if [ "$WT_WIDTH" -gt 178 ]; then
WT_WIDTH=120
fi
WT_MENU_HEIGHT=$(($WT_HEIGHT-7))
## Get Architecture
ARCH=$(dpkg --print-architecture)
## Dialog Menu
if [ "$ARCH" = "armhf" ] || [ "$ARCH" = "arm64" ] ; then
sw=`DIALOG_ERROR=5 DIALOG_ESC=1 dialog --timeout 6 --no-cancel --title "Raspberry Pi Startup Selection Tool" --backtitle "$(cat /proc/device-tree/model)" \
--menu "Startup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
"1 EmulationStation" "Front-end of RetroPie Project" \
"2 Desktop" "Raspbian PIXEL Desktop Enviroment" \
"3 Console" "Abort auto-start and remain in console" \
3>&1 1>&2 2>&3`
else
sw=`DIALOG_ERROR=5 DIALOG_ESC=1 dialog --timeout 6 --no-cancel --title "Raspberry Pi Startup Selection Tool" \
--menu "Startup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
"1 EmulationStation" "Front-end of RetroPie Project" \
"2 Desktop" "Raspbian PIXEL Desktop Enviroment" \
"3 Console" "Abort auto-start and remain in console" \
3>&1 1>&2 2>&3`
fi
rc=$?
#reset #no needed
clear
source $HOME/.bashrc
case $rc in
0)
case "$sw" in
"1 EmulationStation")
emulationstation ;;
"2 Desktop")
startx ;;
"3 Console")
echo "" ;;
*)
emulationstation ;;
esac;;
1)
emulationstation ;;
5)
emulationstation ;;
*)
emulationstation ;;
esac
This is what it looks like:
autostart_retropie_screenshot
It's set to run emulationstation by default. A timeout of 6 seconds is established, so if the user does not press any key for 6 seconds, the default option (emulationstation) is executed. I've used dialog for the menu instead of whiptailonly because this last doesn't have the --timeout option, and although you can achieve a similar effect with other tricks it's a bit more complicated, both should work fine either way.